<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
  <head>
    <base href="<%=basePath%>" />
    
    <title>发送信件</title>
    
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" /> 
	<meta http-equiv="description" content="This is my page" />
	<link rel="stylesheet" href="css/style.css" type="text/css"></link>
	<link rel="stylesheet" href="css/style_.css" type="text/css"></link>
	<script>  
function selectAllByChk(chk,checkbox) {     
	var size = checkbox.length;
    if(size == null)
        checkbox.checked =chk.checked;
    else{
        for (i = 0; i < checkbox.length; i++) {
            checkbox[i].checked =chk.checked;
        }
	}
}
function shanchu(){
	var delMesIds = document.getElementsByName("delMesIds");
	for(var i=0;i<delMesIds.length;i++){
		if(delMesIds[i].checked){
			if(confirm("是否删除所选信件？")){
				alert("删除成功！");
				return true;				
			}
			return false;
		}			
	}
	alert("没有选择要删除的信件！！！");
	return false;		
}
</script>	
  </head>
  <s:if test="listOutBox.size!=0">
  <body>
  <div class="topTitle">
  		<img src="images/main_28.gif"/>&nbsp;发件箱
  	</div>
  	<center>
		<br />
   		<form name="form1" method="post" action="doDelMessageSend">
   			<table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="table01">
      			<tr>
        			<td class="td_02" colspan="3" align="left"><span class=td_title>发件箱</span></td>        	
      			</tr>
      			<tr>
        			<td class="td_02"></td>        	
      			</tr>
      		</table>
   			<table width="95%" border="0" align="center" cellpadding="2"
				cellspacing="0" class="table01">
				<tr>
					<td width="5%" class="td_top">
						<input name="chk" type="checkbox" id="chk" onclick="selectAllByChk(chk,delMesIds)" value="checkbox0" />
					</td>
					<td width="10%" class="td_top">
						发送人
					</td>
					<td width="15%" class="td_top">
						信息标题
					</td>
					<td width="15%" class="td_top">
						接收人
					</td>
					<td width="30%" class="td_top">
						发送时间
					</td>
					<td width="10%" class="td_top">
						详细
					</td>
				</tr>
				<s:iterator value="listOutBox">		
					<tr>
						<td class="td_02">
							<input type="checkbox" name="delMesIds" value="<s:property value='mesId'/>" />
						</td>					
						<td class="td_02">
							<font color="#000000">
								<s:property value="employeeBySendId.userName"/>
							</font>
						</td>
						<td class="td_02">
							<s:property value="mesTitle"/>
						</td>
						<td class="td_02">
							<s:property value="employeeByGetId.userName"/>
						</td>
						<td class="td_02">
							<s:date name="sendTime" format="yyyy-MM-dd hh:mm:ss" />
						</td>
						<td class="td_02">
							<a href="detailMessage?mid=<s:property value='mesId'/> ">&gt;&gt;&gt;</a>
						</td>
					</tr>
				</s:iterator>					
				<tr>
					<td colspan="4" class="td_02">
						<input type="submit" class="buttonface02" value="删除信件" onclick="return shanchu()" />
						&nbsp;&nbsp;&nbsp;
						<input type="button" onclick="location.href='message.jsp'" class="buttonface02" value=" 返回 "/>
					</td>
					<td  colspan="2" class="td_02" align="right">
						<img src="images/1.gif" width="4" height="5" />
						<a href="getOutMessageBox?page=1">首页</a>
						<img src="images/2.gif" width="3" height="5" />
						<c:if test="${pageBean.currentPage==1}">上一页</c:if>
						<c:if test="${pageBean.currentPage>1}"><a href="getOutMessageBox?page=${pageBean.currentPage-1 }">上一页</a></c:if>
						<c:if test="${pageBean.currentPage==pageBean.totalRecords}">下一页</c:if>
						<c:if test="${pageBean.currentPage<pageBean.totalRecords}"><a href="getOutMessageBox?page=${pageBean.currentPage+1 }">下一页</a></c:if>
						<img src="images/2-2.gif" width="3" height="5" />
						<a href="getOutMessageBox?page=${pageBean.totalRecords }">末页</a>
						<img src="images/3.gif" width="4" height="5" />
						共 ${pageBean.totalRecords } 页&nbsp; 第 ${pageBean.currentPage } 页						
					</td>					
				</tr>
			</table>
   		</form>
   </center>
  </body>
  </s:if>
  <s:else>
  <body>
   <div class="topTitle">
  		<img src="images/main_28.gif"/>&nbsp;发件箱
  	</div>
	<center>
		<br />
   		<form name="form1" method="post" action="doDelMessageSend">
   			<table width="95%" border="0" align="center" cellpadding="2"
				cellspacing="0" class="table01">
				<tr>
					<td width="5%" class="td_top">
					<input name="chk" type="checkbox" id="chk" onclick="selectAllByChk(chk,delMesIds)" value="checkbox0" />
					</td>
					<td width="10%" class="td_top">
						发送人
					</td>
					<td width="15%" class="td_top">
						信息标题
					</td>
					<td width="15%" class="td_top">
						接收人
					</td>
					<td width="30%" class="td_top">
						发送时间
					</td>
					<td width="10%" class="td_top">
						详细
					</td>
				</tr>					
				<tr>
					<td class="td_02" colspan="6" style="font-size: 17px">
						您没有未读信件！！
					</td>
				</tr>					
				<tr>
					<td colspan="6" class="td_02">						
						<input type="button" onclick="location.href='message.jsp'" class="buttonface02" value=" 返回 "/>
					</td>									
				</tr>
			</table>
   		</form>
   </center>
  </body>
  </s:else>
</html>
